from django.conf.urls.defaults import *
from models import *

place_list = {
  'queryset': Place.objects.all(),
}
city_list = {
  'queryset': City.objects.all(),
}
place_type_list = {
  'queryset': PlaceType.objects.all(),
}

urlpatterns = patterns('',
  url(
    regex   = '^cities/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = dict(city_list, slug_field='slug'),
    name    = 'place_city_detail',
  ),
  url(
    regex   = '^cities/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = city_list,
    name    = 'place_city_list',
  ),
  url(
    regex   = '^types/(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = dict(place_type_list, slug_field='slug'),
    name    = 'place_type_detail',
  ),
  url(
    regex   = '^types/$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = place_type_list,
    name    = 'place_type_list',
  ),
  url(
    regex   = '^(?P<slug>[-\w]+)/$',
    view    = 'django.views.generic.list_detail.object_detail',
    kwargs  = dict(place_list, slug_field='slug'),
    name    = 'place_detail',
  ),
  url(
    regex   = '^$',
    view    = 'django.views.generic.list_detail.object_list',
    kwargs  = place_list,
    name    = 'place_index',
  ),
)